import time
from selenium import webdriver
from selenium.webdriver.common.by import By

# （A3mall页面搜索）
# driver=webdriver.Edge()
# driver.maximize_window()
# driver.get('http://10.59.9.12:7001')
# time.sleep(2)
# driver.find_element(By.XPATH,'//*[@id="searchForm"]/div[1]/input').send_keys("暖风机")
# time.sleep(3)
# driver.find_element(By.XPATH,'//*[@id="searchForm"]/div[2]/input').click()
# time.sleep(5)



#  （百度页面搜索）
# driver=webdriver.Edge()
# driver.maximize_window()
# driver.get('https://www.baidu.com//')
# time.sleep(8)
# driver.find_element(By.ID,'kw').send_keys("小米su7")
# time.sleep(2)
# driver.find_element(By.ID,'su').click()
# time.sleep(5)



#   （更改商品数量）
# driver=webdriver.Edge()
# driver.maximize_window()
# driver.get('http://10.59.9.12:7001/')
# time.sleep(5)
# # 1、搜索框搜素非洲之心
# driver.find_element(By.CLASS_NAME,'search-input').send_keys("非洲之心")
# time.sleep(2)
# # 2、点击搜索按钮
# driver.find_element(By.CLASS_NAME,'search-input-btn').click()
# time.sleep(5)
# # 3、断言1 （断言文本“搜索结果”）  find查找  element元素，定位      /html/body/div[4]/a[2]
# dy1=driver.find_element(By.XPATH,'/html/body/div[4]/a[2]').text
# print(dy1)
# # 4、点击商品图片
# driver.find_element(By.XPATH,'/html/body/div[5]/div[2]/div[2]/div[1]/ul/li/div[1]/span/a/img').click()
# time.sleep(5)
# # 5、商品数量改为2  //*[@id="store_nums"]
# # driver.find_element(By.ID,'store_nums').send_keys('2')
# # time.sleep(3)
# # 先清空商品数量
# driver.find_element(By.ID,'store_nums').clear()
# time.sleep(3)
# # 改成2
# driver.find_element(By.ID,'store_nums').send_keys('2')
# time.sleep(3)






# A3mall登录
# driver=webdriver.Edge()
# driver.maximize_window()
# driver.get('http://10.59.9.12:7001/')
# time.sleep(5)
# # 1、点击登录   /html/body/div[1]/div/div[2]/ul/li[1]/a
# driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').click()
# # 2、会员登录    /html/body/div[4]/div/div[1]/div[1]/span[1]
# dy1=driver.find_element(By.XPATH,'/html/body/div[4]/div/div[1]/div[1]/span[1]').text
# print(dy1)
# # 3、用户名输入
# driver.find_element(By.NAME,'username').send_keys('13811033962')
# time.sleep(3)
# # 4、密码输入
# driver.find_element(By.NAME,'password').send_keys('123456')
# time.sleep(10)
# # 5、点击登录按钮
# driver.find_element(By.XPATH,'//*[@id="theForm"]/div[5]/a').click()
# time.sleep(5)
#
# # 6、断言  欢迎回来
# dy2=driver.find_element(By.XPATH,'/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[1]').text
# print(dy2)
# time.sleep(5)
# # 7、断言3  账户余额
# dy3=driver.find_element(By.XPATH,'/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[4]').text
# print(dy3)
# time.sleep(5)




# 百度页面(多窗口切换页面)
# driver=webdriver.Edge()
# driver.maximize_window()
# driver.get('https://www.baidu.com//')
# driver.find_element(By.XPATH,'//*[@id="nv"]/a[1]').click()
# time.sleep(3)
# driver.switch_to.window(driver.window_handles[-1])
# driver.find_element(By.PARTIAL_LINK_TEXT,'两山').click()
# time.sleep(10)


# 百度页面 输入框 搜索黄金  TAG_NAME  'input'
# driver=webdriver.Edge()
# driver.get('http://www.jd.com/')
# time.sleep(2)
# driver.find_element(By.TAG_NAME,'input').send_keys("黄金")
# time.sleep(10)


# 邮箱
# driver=webdriver.Edge()
# driver.maximize_window()
# driver.get('https://www.126.com/')
# time.sleep(2)
# driver.switch_to.frame(driver.find_element(By.XPATH,'//iframe[starts-with(@id,"x-URS-iframe1755313")]'))
# driver.find_element(By.XPATH,'//input[starts-with(@id,"auto-id-17553")]').send_keys('13103053968')
# time.sleep(3)


# 网易云
# driver=webdriver.Edge()
# driver.maximize_window()
# driver.get('https://music.163.com/')
# time.sleep(3)
# driver.switch_to.frame(driver.find_element(By.ID,'g_iframe'))
# driver.find_element(By.XPATH,'//*[@id="g-topbar"]/div[1]/div/a').click()
# time.sleep(5)



# 酒仙网
driver=webdriver.Edge()
driver.maximize_window()
driver.get('https://www.jiuxian.com/')
time.sleep(2)
# 点击请登录
driver.find_element(By.XPATH,'/html/body/div[2]/div/div[1]/div/a[1]').click()
time.sleep(5)
# 点击QQ图标   //*[@id="loginform"]/div/div/div/div/div[1]/div[4]/div/a[1]/i
driver.find_element(By.XPATH,'//*[@id="loginform"]/div/div/div/div/div[1]/div[4]/div/a[1]/i').click()
time.sleep(5)
# 点击密码登录
driver.switch_to.frame(driver.find_element(By.ID,'switcher_plogin'))
time.sleep(5)
driver.find_element(By.ID,'ptlogin_iframe').click()
time.sleep(5)
# 输入用户名  u
driver.find_element(By.ID,'u').send_keys("2440154941")
time.sleep(5)
# 输入密码
driver.find_element(By.ID,'p').send_keys("123")
time.sleep(5)






